public class calculate {
    public static void main(String[] args) {
        add(2,4);
        reduce(2,4);
        multiply(2,4);
        device(2,4);
    }
    public static void add(double x,double y){
        double sum;
        sum=x+y;
        System.out.println("相加的和："+sum);
}
    public static void reduce(double x,double y){
        double sum;
        sum=x-y;
        System.out.println("相减的："+sum);
    }
    public static void multiply(double x,double y){
        double sum;
        sum=x*y;
        System.out.println("相乘的："+sum);
    }
    public static void device(double x,double y){
        double sum;
        if (y!=0) {
            sum=x/y;
            System.out.println("相除的："+sum);
        } else {
            System.out.println("被除数不为零");
        }
    }


}

